<?php
namespace app\common\model;
use app\common\library\ModelHandle;
use think\Env;
use think\Model;

class Images extends Model
{
    protected $pk = 'image_id';

    // 开启自动写入时间戳字段
    protected $autoWriteTimestamp = true;

    public static function modelHandle()
    {
        return new ModelHandle(static::class);
    }
    public function getimageUrlAttr($value)
    {
        return !empty($value) ? Env::get('app.app_host') . $value : '';
    }

    public static function addImages($param)
    {
        return self::insertAll($param);
    }

    //获取指定商品图片
    public static function getImages($shop_id){
        return self::where('shop_id',$shop_id)->column('image_url');
    }

}